package main

import (
	"fmt"
	"log"
	"net/http"
	"strings"
)

func say_hey(w http.ResponseWriter, r *http.Request) {
	r.ParseForm();

	fmt.Println("req: ", r.Form);
	fmt.Println("path", r.URL.Path);
	fmt.Println("scheme", r.URL.Scheme);
	fmt.Println(r.Form["url_long"]);

	for k, v := range r.Form {
		fmt.Println("key: ", k);
		fmt.Println("val: ", strings.Join(v, ";"));
	}

	fmt.Fprintf(w, "hey\n");
}

func main() {
	http.HandleFunc("/", say_hey);

	err := http.ListenAndServe(":9090", nil);
	if err != nil {
		log.Fatal("Listen and serve: ", err);
	}

}
